package com.yulongtian.oneProblemEveryDay.month202301;

/**
 * https://leetcode.cn/problems/count-asterisks/
 * 可
 *
 * @author yulongTian
 * @create 2023-01-29 0:25
 */
public class Test20 {
    public static void main(String[] args) {

    }

    public static int countAsterisks(String s) {
        int ans = 0;
        int flag = 0;
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (c == '|') {
                flag++;
                flag %= 2;
            }
            if (flag == 0) {
                if (c == '*') {
                    ans++;
                }
            }
        }
        return ans;
    }
}
